package com.yisu.expressway.ewf.web.springmvc.controller;

import com.yisu.expressway.ewf.common.web.JsonResult;
import com.yisu.expressway.ewf.web.springmvc.xuser.XUser;
import com.yisu.expressway.ewf.web.springmvc.xuser.XUserSession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.servlet.ModelAndView;

/**
 * Created by LKL on 2016/8/20
 */
public class BaseController {
    protected Logger logger = LoggerFactory.getLogger(getClass());

    protected JsonResult newJsonResult() {
        return new JsonResult();
    }

    protected JsonResult newJsonResult(Integer code, String msg, Object data) {
        return new JsonResult(code, msg, data);
    }

    protected ModelAndView newModelAndView(String viewName) {
        return new ModelAndView(viewName);
    }

    public XUser getXUser() {
        return XUserSession.getCurrent().getXUser();
    }

}
